<template>
    <van-tabbar route>
        <van-tabbar-item icon="home-o" to="/home">首页</van-tabbar-item>
        <van-tabbar-item icon="hot-o" :to="pay">菜单</van-tabbar-item>
        <van-tabbar-item icon="gold-coin-o" :to="payList">订单</van-tabbar-item>
        <van-tabbar-item icon="shopping-cart-o" :to="cart">购物车</van-tabbar-item>
        <van-tabbar-item icon="friends-o" to="/mys">我的</van-tabbar-item>
    </van-tabbar>
</template>

<script setup>

import { computed } from 'vue';

import { useUserStore } from '@/store/index'

const userStore = useUserStore()

const pay = computed(() => {
    if (!userStore.username && !userStore.token) {
        return '/login'
    } else {
        return '/goodsList'
    }
})

const payList = computed(() => {
    if (!userStore.username && !userStore.token) {
        return '/login'
    } else {
        return '/order/all'
    }
})
const cart = computed(() => {
    if (!userStore.username && !userStore.token) {
        return '/login'
    } else {
        return '/cart/index'
    }
})


</script>

<style lang="scss" scoped>

</style>